<div>
    <h2 id="page-heading">
        <span>Jobs</span>

        <button id="jh-create-entity" class="btn btn-primary float-right jh-create-entity create-job" [routerLink]="['/job/new']">
            <fa-icon icon="plus"></fa-icon>
            <span>
            Create a new Job
            </span>
        </button>
    </h2>

    <jhi-alert-error></jhi-alert-error>

    <jhi-alert></jhi-alert>

    <div class="alert alert-warning" id="no-result" *ngIf="jobs?.length === 0">
        <span>No jobs found</span>
    </div>

    <div class="table-responsive" id="entities" *ngIf="jobs && jobs.length > 0">
        <table class="table table-striped" aria-describedby="page-heading">
            <thead>
                <tr jhiSort [(predicate)]="predicate" [(ascending)]="ascending" [callback]="loadPage.bind(this)">
                    <th scope="col"  jhiSortBy="id"><span>ID</span> <fa-icon icon="sort"></fa-icon></th>
                    <th scope="col"  jhiSortBy="jobTitle"><span>Job Title</span> <fa-icon icon="sort"></fa-icon></th>
                    <th scope="col"  jhiSortBy="minSalary"><span>Min Salary</span> <fa-icon icon="sort"></fa-icon></th>
                    <th scope="col"  jhiSortBy="maxSalary"><span>Max Salary</span> <fa-icon icon="sort"></fa-icon></th>
                    <th scope="col"  jhiSortBy="employeeId"><span>Employee</span> <fa-icon icon="sort"></fa-icon></th>
                    <th scope="col"></th>
                </tr>
            </thead>
            <tbody>
                <tr *ngFor="let job of jobs ;trackBy: trackId">
                    <td><a [routerLink]="['/job', job.id, 'view']">{{ job.id }}</a></td>
                    <td>{{ job.jobTitle }}</td>
                    <td>{{ job.minSalary }}</td>
                    <td>{{ job.maxSalary }}</td>
                    <td>
                        <div *ngIf="job.employeeId">
                            <a [routerLink]="['/employee', job.employeeId , 'view']" >{{ job.employeeId }}</a>
                        </div>
                    </td>
                    <td class="text-right">
                        <div class="btn-group">
                            <button type="submit"
                                    [routerLink]="['/job', job.id, 'view']"
                                    class="btn btn-info btn-sm">
                                <fa-icon icon="eye"></fa-icon>
                                <span class="d-none d-md-inline">View</span>
                            </button>

                            <button type="submit"
                                    [routerLink]="['/job', job.id, 'edit']"
                                    class="btn btn-primary btn-sm">
                                <fa-icon icon="pencil-alt"></fa-icon>
                                <span class="d-none d-md-inline">Edit</span>
                            </button>

                            <button type="submit" (click)="delete(job)"
                                    class="btn btn-danger btn-sm">
                                <fa-icon icon="times"></fa-icon>
                                <span class="d-none d-md-inline">Delete</span>
                            </button>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>

    <div *ngIf="jobs && jobs.length > 0">
        <div class="row justify-content-center">
            <jhi-item-count [page]="page" [total]="totalItems" [itemsPerPage]="itemsPerPage"></jhi-item-count>
        </div>

        <div class="row justify-content-center">
            <ngb-pagination [collectionSize]="totalItems" [(page)]="ngbPaginationPage" [pageSize]="itemsPerPage" [maxSize]="5" [rotate]="true" [boundaryLinks]="true" (pageChange)="loadPage($event)"></ngb-pagination>
        </div>
    </div>
</div>
